package com.hw.test;

import com.google.gson.Gson;
import com.hw.dao.CountriesDao;
import com.hw.entity.Countries;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TGson {
    public static void main(String[] args) {
        String a="{\"cate\":200,\"data\":[{\"countryId\":\"AR\",\"countryName\":\"Argentina\",\"regionId\":2},{\"countryId\":\"AU\",\"countryName\":\"Australia\",\"regionId\":3}]}";
        System.out.println(a);
        Gson gso=new Gson();
        ArrayList<Object > h=new ArrayList<>();
        h.add("jk");
        h.add("jio");
        Map<String,String> jjj=new HashMap<>();
        jjj.put("jk","jkljkl");
        h.add(jjj);
        Map<String ,Object> skk=new HashMap<>();
        skk.put("name","zzz");
        skk.put("data",h);


        System.out.println(gso.toJson(skk));


    }


}

class TT{
    private Integer cate;
    private List data;

    public TT(Integer cate, List data) {
        this.cate = cate;
        this.data = data;
    }

    public Integer getCate() {
        return cate;
    }

    public void setCate(Integer cate) {
        this.cate = cate;
    }

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "TT{" +
                "cate=" + cate +
                ", data=" + data +
                '}';
    }
}
